// 加载环境变量配置
const dotenv = require('dotenv');
const path = require('path');

// 根据当前环境加载不同的.env文件
env = process.env.NODE_ENV || 'development';

// 加载.env文件
dotenv.config({
  path: path.resolve(__dirname, `../.env${env !== 'development' ? `.${env}` : ''}`)
});

// 导出环境变量
exports.PORT = process.env.PORT || 3003;
exports.HOST = process.env.HOST || 'localhost';
exports.ORACLE_USER = process.env.ORACLE_USER;
exports.ORACLE_PASSWORD = process.env.ORACLE_PASSWORD;
exports.ORACLE_CONNECT_STRING = process.env.ORACLE_CONNECT_STRING;
exports.JWT_SECRET = process.env.JWT_SECRET || 'default_jwt_secret';
exports.JWT_EXPIRES_IN = process.env.JWT_EXPIRES_IN || '1h';
exports.ALLOWED_ORIGINS = process.env.ALLOWED_ORIGINS ? process.env.ALLOWED_ORIGINS.split(',') : ['http://localhost:8080'];
exports.LOG_LEVEL = process.env.LOG_LEVEL || 'info';